TOOL.Category		= "Construction"
TOOL.Name			= "#Disable Collision Sounds"
TOOL.Command		= nil
TOOL.ConfigName		= ""

if ( CLIENT ) then
    language.Add( "Tool_collision_noise_name", "Collision Noise Disabler" )
    language.Add( "Tool_collision_noise_desc", "Disable Collision Noises for Entities" )
    language.Add( "Tool_collision_noise_0", "Primary: Turn Collision Noises off" )
end


function TOOL:LeftClick(trace)

	if (!trace.Entity) then return false end
	if (!trace.Entity:IsValid() ) then return false end
	if (trace.Entity:IsPlayer()) then return false end
	if (trace.Entity:IsWorld()) then return false end

	// Make sure there's a physics object to manipulate
	if ( SERVER && !util.IsValidPhysicsObject( trace.Entity, trace.PhysicsBone ) ) then return false end

	// Client can bail out here and assume we're going ahead
	if ( CLIENT ) then return true end

	// Get the entity/bone from the trace
	local Ent  = trace.Entity
	local Bone = trace.PhysicsBone

	// Set the properties

	construct.SetPhysProp( self:GetOwner(), Ent, Bone, nil,  { GravityToggle = Ent:GetPhysicsObject():IsGravityEnabled( ) , Material = "gmod_silent" } ) 

	return true
end

function TOOL:RightClick(Trace)
	self:LeftClick(Trace)
	
	return true
end
